#include <bits/stdc++.h>
using namespace std;
double maxp = 0;
int n, m;
double p(){
    double maxn = 0, minn = 999, t = 0, per = 0;
    double s;
    for (int i = 1; i <= m; i++){
        cin >> s;
        maxn = max(maxn, s);
        minn = min(minn, s);
        t += s;
    }
    t = t - maxn - minn;
    per = t / (m - 2) * 1.0;
    return per;
}
int main(){
    cin >> n >> m;
    for (int i = 1; i <= n; i++){
        maxp = max(maxp, p());
    }
    printf("%.2f", maxp);
    return 0;
}